﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KAImage.Config;
using KAImage.Algorithms;
using LogLib;

namespace KAImage.AlgorAction
{
    public class HSLAction : IAlgorAction
    {
        private string _error = "";

        public string ErrorMessage
        {
            get { return _error; }
        }

        private int _callIndex = 0;
        public int CallIndex
        {
            private set
            {
                _callIndex = value;
            }
            get
            {
                return _callIndex;
            }
        }

        private ImageHSLOffset _option = new ImageHSLOffset();
     
        private bool _enabled = false;
        public bool Enabled
        {
            private set
            {
                _enabled = value;
            }
            get
            {
                return _enabled;
            }
        }

        public HSLAction()
        {
            _option = KAConfigs.HSLOffset;
            _enabled = KAConfigs.AlgorApplying.HSL;
        }

        public bool DoAction(System.Drawing.Bitmap source)
        {
            try
            {
                source.SetHSLOffset(_option);
                return true;
            }
            catch (Exception ex)
            {
                _error = ex.Message;
                Log.WriteAsync(ex.ToString());
                return false;
            }
            
        }
    }
}
